interface Person {
  name: string;
  age: number;
}

let lisi: Person = {
  name: 'lisi',
  age: 23
}


// 定义接口，使用关键字 interface
interface Student {
  name: string;
  age?: number;
}

// 约束Tom这个对象，必须和接口保持一致属性。
// 用接口定义的对象，属性不能多写，也不能少写。
let Tom2: Student = {
  name: 'lisi',
  age: 23
}

interface PersonAny {
  name: string;
  age?: number;
  [propName: string]: any;
}

let Lisi2: PersonAny = {
  name: 'lisi',
  age: 23,
  work: 'zj',
  address: 'bj'
}


interface Cat {
  readonly name: string;
  age?: number;
}

let c1: Cat = {
  name: 'tom',
  age: 2
}

interface Cat2 {
  readonly name: string;
  age?: number;
}
class SmallCat implements Cat {
  name = 'lsj'
  age = 2
  constructor() {
  }
}